
import { reqCateList ,reqClassifyList } from "@/api"

export default {
    state: {
        cateListData: {},//分类页面的数据
    },
    mutations: {
        GETCATELIST(state, cateListData) {
            state.cateListData = cateListData
        }
    },
    actions: {
        //为你推荐与分类列表
        async getCateList({ state, dispatch, commit }, id="") {
            let result = await reqCateList(id)
            // console.log(result.data)
            if (result.code = 200) {
                commit('GETCATELIST', result.data)
            }
        }

    },
    getters: {
        //  左侧导航
        categoryL1List(state) {
            return state.cateListData.categoryL1List || []
        },
        // 为你推荐右侧
        categoryL2List(state) {
            return state.cateListData.categoryL2List || []
        },
        // 为你推荐图片
        currentCategory(state) {
            return state.cateListData.currentCategory || {}
        },
        // 分类列表的数据
        categoryGroupList(state){
            return state.cateListData.categoryGroupList || []
        }
    }
}